package com.ming.attendance.service.impl;

import com.ming.attendance.mapper.BeaconMapper;
import com.ming.attendance.po.Beacon;
import com.ming.attendance.po.ResponseBean;
import com.ming.attendance.service.BeaconService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class BeaconServiceImpl implements BeaconService {

    @Autowired
    private BeaconMapper bm;

    @Override
    public ResponseBean<Integer> addBeacon(Beacon beacon) {
        int result = bm.addBeacon(beacon);
        if(result != 0){
            return new ResponseBean<>(result);
        }else{
            return new ResponseBean<>(602,"添加失败");
        }
    }

    @Override
    public ResponseBean<Integer> unBind(Beacon beacon) {
        beacon.setUsing(0);
        int result = bm.updateBeacon(beacon);
        return new ResponseBean<>(result);
    }


}
